#version 460

#include "../lib/single_color.glsl"


layout(std140, set=0, binding=0) uniform U_Matrix {
	mat4 mat_ProjecView;
	//mat4 mat_view;	
};

//layout(std140, set=1, binding=1) uniform mat4 Model_Matrix;
layout(std140, binding = 1) readonly buffer U1_Matrix {
	mat4 mat_Model[];
};



layout(location = 0) in vec3 inPos;

layout(location = 0) out vec4 vColor;
out gl_PerVertex {
	vec4	gl_Position;
	//float	gl_PointSize;
};


vec3 vs[3] = {vec3(-100,-500,0), vec3(-100,500,0), vec3(500,00,0)};

void main(void) {
	vec4 p = vec4(inPos, 1.0);
	gl_Position = mat_ProjecView * mat_Model[gl_InstanceIndex] * p;
	//gl_Position = vec4(inPos, 1.0);
	vColor = f_buildColor(InstanceColor[gl_InstanceIndex]);

	if(gl_VertexIndex < 3){
		//gl_Position = mat_ProjecView * vec4(vs[gl_VertexIndex], 1.0);
		//gl_Position = vec4(vs[gl_VertexIndex], 1.0);
	}
	//gl_Position = vec4(vs[gl_VertexIndex], 1.0);
	//gl_PointSize = 2.0;
}


